package com.example.yls.demoa.activity;

import android.app.Activity;
import android.graphics.Point;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import com.example.yls.demoa.R;
import com.example.yls.demoa.bean.gobang;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

import cn.bmob.v3.BmobRealTimeData;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;
import cn.bmob.v3.listener.ValueEventListener;

public class MainActivity extends Activity {
    private CustomView customView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        setListener();
    }


    private void setListener() {
        Log.e("获取的id之为",getIntent().getStringExtra("id"));
        customView.setData(getIntent().getStringExtra("id"));

    }

    private void initView() {
        customView=findViewById(R.id.game);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        List<Point> list=new ArrayList<>();
        gobang g=new gobang();
        g.setWhithPosition(list);
        g.setBlackPosition(list);
        g.setWinner(false);
        g.save(new SaveListener<String>() {
            @Override
            public void done(String s, BmobException e) {

            }
        });
    }
}
